{% load staticfiles %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{% block title %}TranOS{% endblock %}</title>

    <!-- Bootstrap -->
    <link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
        <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Font Awesome -->
    <link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet">

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="{% static 'js/bootstrap.min.js' %}"></script>

    <script src="{% static 'js/jquery.scrollUp.min.js' %}"></script>
    <script src="{% static 'js/holder.min.js' %}"></script>

    {% block site_css %}
    <link href="{% static 'css/base.css' %}" rel="stylesheet">
    {% endblock %}

    {% block site_js %}
    <script src="{% static 'js/base.js' %}"></script>
    {% endblock %}

    {% block head-extra %}{% endblock %}
</head>
<body>
    <nav class="navbar navbar-default">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="/">TranOS</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li><a href="{% url 'translations:index' %}">首页</a></li>
                    <li><a href="{% url 'translations:list' %}">译文</a></li>
                    <li><a href="{% url 'translations:untranslated' %}">待译</a></li>
                    <li><a href="{% url 'translations:tags' %}">标签</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    {% if user.is_authenticated %}
                    <li><a href="{{ user.profile.get_absolute_url }}">{{ user.profile }}</a></li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'accounts:setting' user.id %}">账号设置</a></li>
                            <li><a href="{% url 'translations:favorites:list' %}">我的收藏夹</a></li>
                            {% if user.is_staff %}
                            <li class="divider"></li>
                            <li><a href="{% url 'admin:index' %}">管理员</a></li>
                            <li><a href="{% url 'images:list' %}">图片管理</a></li>
                            {% endif %}
                            <li class="divider"></li>
                            <li><a href="{% url 'accounts:logout' %}">退出</a></li>
                        </ul>
                    </li>
                    {% else %}
                    <li><a href="{% url 'accounts:login' %}">登录</a></li>
                    <li><a href="{% url 'accounts:register' %}">注册</a></li>
                    {% endif %}
                </ul>
            </div><!-- /.navbar-collapse -->
        </div><!-- /.container -->
    </nav>

    <div class="container">
        {% if messages %}
            {% for message in messages %}
            <div class="alert alert-success alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                {{ message }}
            </div>
            {% endfor %}
        {% endif %}

        {% block content %}{% endblock %}

        <footer class="footer">
            <p>&copy; 2015 Company, Inc. <a href="{% url 'feedback' %}">反馈</a></p>
        </footer>
    </div>

    <script src="{% static 'js/check_messages.js' %}"></script>
</body>
</html>